<?php $title = ___("Import Finished");
$this->setLayout('admin/layout.phtml'); ?>
<div class="info">
    <p><?php __e('To verify import result go to %saMember CP -> Browse Users%s', '<a href="' . REL_ROOT_URL . '/admin-users">', '</a>') ?></p>
    <p><?php __e('Please run %sRebuild Db%s to update status for imported customers',
    '<a href="' . REL_ROOT_URL . '/admin-rebuild">[', ']</a>') ?></p>
</div>
<div id="import-area">
    <div class="grid-container">
        <table class="grid">
            <tr>
                <td width="20%"><strong><?php __e('Lines Skiped:') ?></strong></td>
                <td><?php p($stat[Import_Log::TYPE_SKIP]) ?></td>
            </tr>
            <tr>
                <td><strong><?php __e('Lines Success:') ?></strong></td>
                <td><?php p($stat[Import_Log::TYPE_SUCCESS]) ?></td>
            </tr>
            <tr>
                <td><strong><?php __e('Lines Proccessed:') ?></strong></td>
                <td><?php p($stat[Import_Log::TYPE_PROCCESSED]) ?></td>
            </tr>
            <tr>
                <td><strong><?php __e('Duration:') ?></strong></td>
                <td><?php p($duration) ?></td>
            </tr>
            <tr>
                <td><strong><?php __e('Errors:') ?></strong></td>
                <?php if ($stat[Import_Log::TYPE_ERROR]) : ?>
                    <td class="expandable" title="<?php __e('Click to Expand') ?>">
                        <div class="arrow"></div>
                    <?php p($stat[Import_Log::TYPE_ERROR]) ?>
                </td>
                <?php else: ?>
                        <td>0</td>
                <?php endif; ?>
                    </tr>
            <?php foreach ($errors as $error) : ?>
                            <tr style="display:none">
                                <td colspan="2" class="expandable-data">
                    <?php p($error['msg']) ?>
                            <hr>
                            <pre><?php print_r($error['lineParsed']) ?></pre>
                        </td>
                    </tr>
            <?php endforeach; ?>
        </table>
    </div>
</div>

<script type="text/javascript">
    (function($){
        $(function(){
            $(".expandable").click(function(){
                if ($(this).hasClass('expanded')) {
                    $(this).removeClass('expanded');
                    $(this).parent().nextAll().hide();
                } else {
                    $(this).addClass('expanded');
                    $(this).parent().nextAll().show();
                }

            })
        })
    })(jQuery)
</script>
